package com.lovo.project2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lovo.project2.bean.SaleCartBean;
import com.lovo.project2.mapper.ISaleCartBeanMapper;
import com.lovo.project2.service.ISaleCartService;

import java.util.List;

public class SaleCartServiceImpl extends ServiceImpl<ISaleCartBeanMapper, SaleCartBean> implements ISaleCartService {
    @Override
    public List<SaleCartBean> queryAllSaleCartBeanBySaleId(int UserId) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("user_id",UserId);
        return baseMapper.selectList(queryWrapper)  ;
    }

    @Override
    public void removeSaleCart(int saleCartId) {
baseMapper.deleteById(saleCartId);
    }

    @Override
    public void addSaleCartBean(SaleCartBean saleCartBean) {
baseMapper.insert(saleCartBean);

    }

    @Override
    public void updateSaleCartBean(int salaCardId,int numb) {
SaleCartBean saleCartBean=new SaleCartBean();
saleCartBean.setSaleId(salaCardId);
saleCartBean.setNumber(numb);
baseMapper.updateById(saleCartBean);
    }

    @Override
    public void delectUserIdCart(int userId) {
QueryWrapper queryWrapper=new QueryWrapper();
queryWrapper.eq("user_id",userId);
baseMapper.selectList(queryWrapper);
    }
}
